package com.imooc.SmartChargeStation.demo.controller;

import com.imooc.SmartChargeStation.demo.mqtt.FacoryMode.service.MqttService;
import com.imooc.SmartChargeStation.demo.mqtt.PahoMode.service.impl.ClientServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * author: Imooc
 * description: mqtt(基于Spring Integration) web控制器
 * date: 2024
 */

@RestController
public class MqttFactoryCtl {

    @Resource
    private MqttService service;


    //mqtt客户端发送消息

    @RequestMapping(value = "/factory/pub")
    public void pahoPub(
            @RequestParam("topic") String topic,
            @RequestParam("message") String message) {

        System.out.println("controller层发送topic:"+topic+"  message:"+message);
        service.send(topic,message);

    }

}
